#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <fstream>

using namespace std;

int sm(int & n, vector<int>);
int fm(int & n, vector<int>);

#define debug

int main()
{

#ifdef debug
    ifstream cin("E:\\git\\cp\\InfiniteHouseofPancakes\\input.in");
    ofstream cout("E:\\git\\cp\\InfiniteHouseofPancakes\\output.out");
#endif

    int t, n;
    cin >> t;
    for(int i = 1; i <= t; i++)
    {
        cin >> n;
        vector<int> a(n);
        for(int j = 0; j < n; j++)
            cin >> a[j];
        cout << "Case #" << i << ": ";
        cout << sm(n, a);
        cout << endl;
    }
    return 0;
}

int sm(int & n, vector<int> a)
{
    int max = fm(n, a);
    int k, d;
    int ans = a[max];               //将预测时间调到最大，即一直没有停下分饼
    for(k = 1; k < a[max]; k++)
    {
        d = 0;
        for(int i = 0; i < n; i++)
        {
            if(a[i] > k)
            {
                int v = ceil((double)a[i] / (double)k); //分成 a[i] / k 份
                d += v - 1;                             //需要停下来分的时间
            }
        }
        ans = min(ans, d + k);          //d+k是指分的份有k个煎饼，然后加分的时间
    }
    return ans;
}

int fm(int & n, vector<int> a)       //求单人拥有煎饼的最大值，返回下标
{
    int max = 0;
    for(int i = 0; i < n; i++)
        if(a[i] > a[max]) max = i;
     return max;
}
